package com.jutixueyuan.controller;

import com.jutixueyuan.pojo.LivegoodsResult;
import com.jutixueyuan.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SearchController {

    @Autowired
    private SearchService searchService;


    @RequestMapping("/init")
    public Long init(){
        Long result = searchService.init();
        return result;
    }


    @RequestMapping("/search")
    public LivegoodsResult search(String city, String content, Integer page, @RequestParam(defaultValue = "10")Integer size){
        LivegoodsResult livegoodsResult = searchService.search(city,content,page,size);

        return livegoodsResult;
    }
}
